package com.soso.base.util.other;

import org.apache.commons.codec.binary.Base64;

public class EncodeUtil {

	/**
	 * base64加密
	 * 
	 * @param s
	 * @return
	 */
	public static String encodeBase64(String s) {
		Base64 base64 = new Base64();
		byte[] enbytes = base64.encode(s.getBytes());
		return new String(enbytes);
	}

	/**
	 * base64解密
	 * 
	 * @param s
	 * @return
	 */
	public static String unEncodeBase64(String s) {
		Base64 base64 = new Base64();
		byte[] debytes = base64.decode(s.getBytes());
		return new String(debytes);
	}

}